Skip to content

Generate Zig metadata before final build#2867

Open
plajjan wants to merge 3 commits into
mainfrom
gen-zig-metadata-before-build
Open

Generate Zig metadata before final build#2867
plajjan wants to merge 3 commits into
mainfrom
gen-zig-metadata-before-build

Conversation

@plajjan
Copy link
Copy Markdown
Contributor

@plajjan plajjan commented Jun 3, 2026

Root build.zig and build.zig.zon were generated from inside the final Zig build path. That meant --skip-build could refresh dependency metadata while leaving the root project metadata stale or missing.

This moves the root metadata write into the post-compile step that already prepares dependency metadata before the final build decision. The final Zig build still owns root stub generation, pruning, and invoking Zig, so --skip-build stops after metadata while normal builds keep the same final build behavior.

The metadata-only tests now use --skip-build for the cases that only inspect generated build.zig.zon contents.

Kristian Larsson added 3 commits June 4, 2026 01:49
Root build.zig and build.zig.zon were generated inside zigBuild.
That meant --skip-build refreshed dependency metadata but left the
root project metadata stale or missing.

Generate the root metadata in the post-compile step that already
handles dependency metadata, before deciding whether to run the final
Zig build. Keep root stubs, pruning, and the Zig invocation inside
zigBuild.
Root build.zig metadata is now generated before final build execution
so --skip-build callers get the files they need.

That path does not need a new verbose line; leaving output unchanged
preserves the existing incremental build output shape.
The Zig dependency collision tests only inspect generated build.zig
and build.zig.zon contents. They do not need to invoke the final Zig
build after the metadata has been written.

Run those fixtures with --always-build --skip-build so the front end
still refreshes the generated metadata without spending time linking
temporary Zig artifacts.
@plajjan plajjan marked this pull request as ready for review June 4, 2026 03:38
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c4741bb71f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread compiler/acton/Main.hs
Comment on lines +2013 to +2014
unless isRootSysProj $
genBuildZigFiles rootSpec rootPins (ccDepOverrides cctx) pathsRoot rootDepModuleOpts rootDepPathOverrides
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Guard root metadata writes in alt-output modes

When acton build is run with an alternate output flag such as --sigs, --parse, or --cgen, the existing final build path is still skipped by the later unless (altOutput opts'), so these commands are intended to dump analysis/codegen output without touching the root Zig project files. This unconditional root genBuildZigFiles call now overwrites build.zig and build.zig.zon even in those modes; please keep it under the same non-altOutput condition (while still allowing --skip-build) so inspection commands do not mutate project metadata.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant